/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author puflitos
 */
@Entity
@Table(name = "estadolagar", catalog = "pesaje20125", schema = "")
@NamedQueries({
    @NamedQuery(name = "Estadolagar.findAll", query = "SELECT e FROM Estadolagar e"),
    @NamedQuery(name = "Estadolagar.findByIdEstadoLagar", query = "SELECT e FROM Estadolagar e WHERE e.idEstadoLagar = :idEstadoLagar"),
     @NamedQuery(name = "Estadolagar.findLagar", query = "SELECT e FROM Estadolagar e WHERE e.idLagar = :idLagar"),
    @NamedQuery(name = "Estadolagar.findByIdentificacion", query = "SELECT e FROM Estadolagar e WHERE e.identificacion = :identificacion"),
    @NamedQuery(name = "Estadolagar.findByEstado", query = "SELECT e FROM Estadolagar e WHERE e.estado = :estado")})
public class Estadolagar implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idEstadoLagar", nullable = false)
    private Integer idEstadoLagar;
    @Basic(optional = false)
    @Column(name = "Identificacion", nullable = false, length = 45)
    private String identificacion;
    @Basic(optional = false)
    @Column(name = "estado", nullable = false, length = 45)
    private String estado;
    @JoinColumn(name = "idLagar", referencedColumnName = "idLagar")
    @ManyToOne(optional = false)
    private Lagar idLagar;

    public Estadolagar() {
    }

    public Estadolagar(Integer idEstadoLagar) {
        this.idEstadoLagar = idEstadoLagar;
    }

    public Estadolagar(Integer idEstadoLagar, String identificacion, String estado,Lagar idLagar) {
        this.idEstadoLagar = idEstadoLagar;
        this.identificacion = identificacion;
        this.estado = estado;
        this.idLagar=idLagar;
    }

    public Integer getIdEstadoLagar() {
        return idEstadoLagar;
    }

    public void setIdEstadoLagar(Integer idEstadoLagar) {
        Integer oldIdEstadoLagar = this.idEstadoLagar;
        this.idEstadoLagar = idEstadoLagar;
        changeSupport.firePropertyChange("idEstadoLagar", oldIdEstadoLagar, idEstadoLagar);
    }

    public String getIdentificacion() {
        return identificacion;
    }

    public void setIdentificacion(String identificacion) {
        String oldIdentificacion = this.identificacion;
        this.identificacion = identificacion;
        changeSupport.firePropertyChange("identificacion", oldIdentificacion, identificacion);
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        String oldEstado = this.estado;
        this.estado = estado;
        changeSupport.firePropertyChange("estado", oldEstado, estado);
    }
public Lagar getIdLagar() {
        return idLagar;
    }

    public void setIdLagar(Lagar idLagar) {
        Lagar oldIdLagar = this.idLagar;
        this.idLagar = idLagar;
        changeSupport.firePropertyChange("idLagar", oldIdLagar, idLagar);
    }
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoLagar != null ? idEstadoLagar.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estadolagar)) {
            return false;
        }
        Estadolagar other = (Estadolagar) object;
        if ((this.idEstadoLagar == null && other.idEstadoLagar != null) || (this.idEstadoLagar != null && !this.idEstadoLagar.equals(other.idEstadoLagar))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Estadolagar[idEstadoLagar=" + idEstadoLagar + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
